﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BaiTu.IOCServices;
using BaiTu.IEventServices;
using BaiTu.TestIng.Domain;

namespace BaiTu.EventServices.Testing
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            try
            {
                IOCServices.EngineContext.Initialize(true);

                IEventBus eventBus = EngineContext.Current.Resolve<IEventBus>();

                Console.WriteLine("Event_Pub OK, ready publish event.");

                BaiTu.TestIng.Domain.TestEvebt evt = new TestEvebt();


                int i = 0;
                while (true)
                {
                    i++;
                    evt.Name = DateTime.Now.ToString();
                    eventBus.Publish<TestEvebt>(evt);
                    Console.WriteLine(i);
                }

                Console.WriteLine("done.");
            }
            catch (Exception ex)
            {

            }
        }
    }
   
}
